<HTML><HEAD><TITLE>clause(+Clause)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Dynamic Predicates</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>clause(+Clause)</H1>
Succeeds if Clause unifies with a clause of a dynamic procedure.


<DL>
<DT><EM>Clause</EM></DT>
<DD>Atom or compound term
</DD>
</DL>
<H2>Description</H2>
   Finds a dynamic clause whose head unifies with the head of Clause and
   unifies the body of the clause with the body of Clause.  The head of
   Clause must be sufficiently instantiated so that the predicate (head) of
   the clause can be determined.  The functor of the head of Clause must be
   that of a procedure previously declared as dynamic using dynamic/1.

<P>
   This goal may be resatisfied if there are several clauses which match
   the first argument.  In the first solution the argument will be unified
   with the first such clause.  Subsequent solutions will unify the
   argument to the other clauses in the same order in which they are listed
   by listing/0, 1.

<P>
   clause/1 satisfies the logical update semantics.  When clause/1 is first
   called, it makes a virtual copy of the clauses that match and, on
   backtracking, unifies its argument with them.  Any modifications made to
   the procedure after clause/1 has started executing do not, in any way,
   affect the solutions produced.  A subsequent call, however makes and
   uses a new, virtual, copy of the modified database.

<P>
   No clause transformation is performed on Clause. Use expand_clause/2 to
   explicitly expand the clause before calling this predicate if clause
   expansion is rquired.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>clause(+) is nondet
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Fail Conditions</H3>
Fails if no dynamic clause unifies with Clause
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Clause is not instantiated
<DT><EM>(4) instantiation fault </EM>
<DD>The head of Clause is a free variable.
<DT><EM>(63) procedure not dynamic </EM>
<DD>Procedure is not dynamic
<DT><EM>(70) accessing an undefined dynamic procedure </EM>
<DD>Procedure is undefined
</DL>
<H2>See Also</H2>
<A HREF="../../kernel/dynamic/clause-2.html">clause / 2</A>
</BODY></HTML>
